package com.tjsinfo.tjsoa.articles.bo;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.tjsinfo.tjsoa.Dao.IHibernateDao;
import com.tjsinfo.tjsoa.Dao.IQbcDao;
import com.tjsinfo.tjsoa.articles.vo.TIndexArticles;
import com.tjsinfo.tjsoa.system.vo.TjsRoles;
//import com.tjsinfo.articles.vo.TArticlesUserRole;
//import com.tjsinfo.tjsoa.system.vo.TSystemUserRole;

/**
 * 菜单BO
 * @author 天津市电子计算机研究所
 *
 */
public class TArticlesRolesManageImpl  implements TArticlesRolesManage{
	private IQbcDao qbcDao;
	private IHibernateDao hibernateDao;

	public IHibernateDao getHibernateDao() {
		return hibernateDao;
	}

	public void setHibernateDao(IHibernateDao hibernateDao) {
		this.hibernateDao = hibernateDao;
	}

	public IQbcDao getQbcDao() {
		return qbcDao;
	}

	public void setQbcDao(IQbcDao qbcDao) {
		this.qbcDao = qbcDao;
	}
	
	public TjsRoles findById(Integer id) {
		// TODO Auto-generated method stub
		String strroleid=","+String.valueOf(id)+",";
		DetachedCriteria criteria = DetachedCriteria.forClass(TjsRoles.class);
		criteria.add(Restrictions.eq("roleId", strroleid));
		criteria.addOrder(Order.desc("id"));
		List<TjsRoles> list =  (List<TjsRoles>)qbcDao.getCriteria(criteria); 
		return list.get(0);
//		return  (TjsRoles) hibernateDao.findById(TjsRoles.class, id);
	}
}
